import { http } from '@/utils/http'
import type { Doctor } from '@/types/doctor'
import type { PageResult } from '@/types/global'
import type { MedicineItem } from '@/types/medicine'

export function getMedicines() {
  return http<PageResult<MedicineItem>>({
    method: 'GET',
    url: '/prescription/prescription/listMedicines',
  })
}

export const submitAPI = (doctor: Doctor) => {
  return http<Doctor>({
    method: 'POST',
    data: doctor,
    url: '/person/doctor/submit'
  })
}

export const getDoctors = () => {
  return http<Required<Doctor>[]>({
    method: 'GET',
    url: `/person/doctor`
  })
}

export const getDoctor = (id: number) => {
  return http<Required<Doctor>>({
    method: 'GET',
    url: `/person/doctor/${id}`
  })
}

export const verifyDoctor = (verifyData: Pick<Required<Doctor>, 'id' | 'verifyStatus'>) => {
  return http({
    method: 'POST',
    data: verifyData,
    url: '/person/doctor/verify'
  })
}
